package com.qgs.secsgem.secs.entity.common;

import com.alibaba.fastjson.annotation.JSONType;
import com.qgs.secsgem.common.utils.CommonFunction;
import lombok.Data;

/**
 * @Desc: ""
 * @Author: caixiang
 * @DATE: 2021/8/12 15:26
 */
@Data
@JSONType(orders={"transactionId","messageType","messageCategory","messageName","equipmentId","sendTimestamp","from","to"})
public class Header {
    private String transactionId;
    private String messageType;
    private String messageCategory;
    private String messageName;
    private String equipmentId;
    private String sendTimestamp;
    private String from;
    private String to;

    //注意：一定要构造一个空的  构造函数，不然fastjson在序列化 和反序列化的时候会用下面的Header这样导致数据一致
    public Header() {

    }

    public Header(String transactionId, String messageType, String messageCategory, String messageName, String equipmentId, String sendTimestamp, String from, String to) {
        this.transactionId = transactionId;
        this.messageType = messageType;
        this.messageCategory = messageCategory;
        this.messageName = messageName;
        this.equipmentId = equipmentId;
        this.sendTimestamp = sendTimestamp;
        this.from = from;
        this.to = to;
    }

    public Header(String messageType, String messageCategory, String messageName, String equipmentId) {

        this.transactionId = equipmentId+"_"+ CommonFunction.getNowDate(2)+"_"+CommonFunction.getUUID(5);
        this.messageType = messageType;
        this.messageCategory = messageCategory;
        this.messageName = messageName;
        this.equipmentId = equipmentId;
        this.sendTimestamp = CommonFunction.getNowDate(1);
        this.from = "mes";
        this.to = "eap";
    }


    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getMessageType() {
        return messageType;
    }

    public void setMessageType(String messageType) {
        this.messageType = messageType;
    }

    public String getMessageCategory() {
        return messageCategory;
    }

    public void setMessageCategory(String messageCategory) {
        this.messageCategory = messageCategory;
    }

    public String getMessageName() {
        return messageName;
    }

    public void setMessageName(String messageName) {
        this.messageName = messageName;
    }

    public String getEquipmentId() {
        return equipmentId;
    }

    public void setEquipmentId(String equipmentId) {
        this.equipmentId = equipmentId;
    }

    public String getSendTimestamp() {
        return sendTimestamp;
    }

    public void setSendTimestamp(String sendTimestamp) {
        this.sendTimestamp = sendTimestamp;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }
}
